<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
	<title>直接分配操作权限</title>
	<%@ include file="/common/meta.jsp" %>
    <%@ include file="/common/import.jsp" %>
	<%@ include file="uct-import.jsp" %>
	<script>
		var userId="${userId}";
		$(function(){
			$('#actList').treegrid({
				title:'',
				//iconCls:'icon-ok',
				//width:800,
				fitColumns: true,
				nowrap: true,
				rownumbers: true,
				animate:true,
				collapsible:false,
				singleSelect:false,
				url:'user-right-act!data.action?userId='+userId , 
				idField:'actId',
				treeField:'actCname',				
				frozenColumns:[[

	                {title:'权限名',field:'actCname',width:300,
		                formatter:function(value){
		                	return '<span style="color:red">'+value+'</span>';
		                }
	                }
	                
				]],
				columns:[[
					{title:'英文全称',field:'fullEname',width:250},
					{title:'中文文全称',field:'fullCname',width:250},				
					{title:'操作',field:'hasGive',width:100,
						formatter:function(value,row){
								if(value=="T"){
									return '<img id="hasGive_'+row.actId+'" name="hasGiveCheck" src="${ctx}/js/easyui/themes/default/images/tree_dnd_yes.png"/>';
								}else{
									return '<img id="hasGive_'+row.actId+'" name="hasGiveCheck" src="${ctx}/js/easyui/themes/default/images/tree_dnd_no.png"/>';;
								}
							
						}
					}
				]],
				onDblClickRow:function(row){  
                    //级联选择  
                    $(this).treegrid("cascadeCheck",{  
                        id:row.actId, //节点ID  
                        imgsrc:"${ctx}/js/easyui/themes/default/images/",
                        deepCascade:true //深度级联  
                    });  
                }  
			});
		});
		
		function giveActs(actId,flag,tmppic){
				$.ajax({
							type: "post",
							url: "${ctx}/uct/core/authorize-act.action?actGiveType=user&flag="+flag+"&id="+actId+"&objId="+userId,
							async:false,
							success: function(data, textStatus){
								$("#hasGive_"+actId).attr("src",tmppic);
							}
						});
		
	}

			
		function expandAll(){
			var node = $('#actList').treegrid('getSelected');
			if (node){
				$('#actList').treegrid('expandAll', node.code);
			} else {
				$('#actList').treegrid('expandAll');
			}
		}
	</script>
</head>

<body>
<table id="actList"></table>	
</body>
</html>